package structs

const (
	tcpAddr1 = "192.168.20.151:8200" // 替换为IPC设备的实际IP地址和端口
	tcpAddr2 = "192.168.20.121:8200" // 替换为IPC设备的实际IP地址和端口

	connRequestType  = 0x1007
	connResponseType = 0x1008
	msgResponseType  = 0x2002
)

// DeviceSerialStruct  设备板号结构体
type DeviceSerialStruct struct {
	serialNumber string
}

// TcpSocketConnStruct  主线程任务结构体
type TcpSocketConnStruct struct {
	devId            string
	ip               string
	port             string
	heartBeat        int
	connRequestType  uint32 //tcp连接请求协议
	connResponseType uint32 //tcp请求确返协议
	msgResponseType  uint32 //信号类型确认协议
}

func NewTcpSocketConnStruct(devId string, ip string, port string, heartBeat int) *TcpSocketConnStruct {
	// 设置默认心跳值
	if heartBeat <= 0 {
		heartBeat = 30
	}
	return &TcpSocketConnStruct{
		devId:            devId,
		ip:               ip,
		port:             port,
		heartBeat:        heartBeat,
		connRequestType:  connRequestType,
		connResponseType: connResponseType,
		msgResponseType:  msgResponseType,
	}
}

func (m *TcpSocketConnStruct) GetConnRequestType() uint32 {
	return m.connRequestType
}
func (m *TcpSocketConnStruct) SetConnRequestType(connRequestType uint32) {
	m.connRequestType = connRequestType
}
func (m *TcpSocketConnStruct) GetConnResponseType() uint32 {
	return m.connResponseType
}
func (m *TcpSocketConnStruct) SetConnResponseType(connResponseType uint32) {
	m.connResponseType = connResponseType
}
func (m *TcpSocketConnStruct) GetMsgResponseType() uint32 {
	return m.msgResponseType
}
func (m *TcpSocketConnStruct) SetMsgResponseType(msgResponseType uint32) {
	m.msgResponseType = msgResponseType
}

func (m *TcpSocketConnStruct) GetDevId() string {
	return m.devId
}
func (m *TcpSocketConnStruct) SetDevId(devId string) {
	m.devId = devId
}
func (m *TcpSocketConnStruct) GetIp() string {
	return m.ip
}
func (m *TcpSocketConnStruct) SetIp(ip string) {
	m.ip = ip
}

func (m *TcpSocketConnStruct) GetHeartBeat() int {
	return m.heartBeat
}

func (m *TcpSocketConnStruct) SetHeartBeat(heartBeat int) {
	m.heartBeat = heartBeat
}

func (m *TcpSocketConnStruct) GetPort() string {
	return m.port
}

func (m *TcpSocketConnStruct) SetPort(port string) {
	m.port = port
}
